function [baseband,data4bit]=qam16gen(N,data)
%  data=randi([0,1],N,1);
% load('data.mat');
 Interpolation_rate = 16;
for i=1:length(data)
    s = mod(i,2);
    j = ceil(i/2);
    if s==1
        data_xp(j) = data(i);
    end
    if s==0
        data_yp(j) = data(i);
    end
end
data_com=data_xp+sqrt(-1)*data_yp;
for i=1:2:length(data_xp)
    j = ceil(i/2);
    if(data_xp(i)==0)
        if(data_xp(i+1)==0)
            data_x4bit(j) = -3;          %00
        else data_x4bit(j) = -1;         %01
        end
    else if(data_xp(i+1)==1)
            data_x4bit(j) = 1;           %11
        else data_x4bit(j) = 3;          %10
        end
    end
end

for i=1:2:length(data_yp)
    j = ceil(i/2);
    if(data_yp(i)==0)
        if(data_yp(i+1)==0)
            data_y4bit(j) = -3;          %00
        else data_y4bit(j) = -1;         %01
        end
    else if(data_yp(i+1)==1)
            data_y4bit(j) = 1;           %11
        else data_y4bit(j) = 3;          %10
        end
    end
end
data4bit=data_x4bit+sqrt(-1)*data_y4bit;
data_xup = upsample(data_x4bit,Interpolation_rate);  
data_yup = upsample(data_y4bit,Interpolation_rate);
% data_up=data_xup+sqrt(-1)*data_yup;
% data_up=upsample(data4bit,Interpolation_rate);
%成形滤波器 97*16bit   
alpha = 0.35;
hrc_send = rcosdesign(alpha,6,Interpolation_rate,'sqrt');  %成型滤波器

data_basebandx= conv(data_xup,hrc_send);

data_basebandy = conv(data_yup,hrc_send); 

baseband = data_basebandx+1j*data_basebandy;
% data_base=baseband(6*Interpolation_rate/2+1:end-6*Interpolation_rate/2);
end